public class Main1092 {
    public static void main(String[] args) {
        for (int i=1;;i++){
            int n=i*i;
            if (n<1000)continue;
            if (n>9999)break;
            int q=n/1000;
            int b=n/100%10;
            int s=n%100/10;
            int g=n%10;
            if (q==b&&s==g){
                System.out.println(n);
            }
        }
    }
}
